use StuDents
go

--��ֵ����
alter function fun_Get
(
	 @id int
)
returns table
as
   return
    (
		with CTE_A(����,�γ�)
			as
			(
			  select a.stuName ,b.ClassName  from StuInfo a
			  inner join StuClassInfo b on a.id=b.stuId where a.id=@id
			)select * from CTE_A 
	)
go

--����
select * from dbo.fun_Get(2) --��һ��ѧ����id ��ѯѧ�������Լ�ѧϰ�Ŀγ�



select * from StuInfo
select * from StuClassInfo
